
#include "member_BControl.h"

using namespace BWE;

member_BControl::member_BControl(BControl* controlder)
{
	boss = controlder;
	viewer = 0;
	master = 0;
}

member_BControl::~member_BControl()
{

}

void member_BControl::setViewer(BViewer* viewer)
{
	if (this->viewer != viewer)
	{
		if (this->viewer)
		{
			BEvent event(Event_Detach);
			boss->event(event);
		}
		this->viewer = viewer;
		if (this->viewer)
		{
			BEvent event(Event_Attach);
			boss->event(event);
		}
		for (int i = 0; i < slaves.size(); i++)
		{
			BControl* slave = slaves[i];
			control_member(slave)->setViewer(viewer);
		}
	}
}
